import { Loading } from 'element-ui'

const loadOption = { customClass: 'common-load', fullscreen: true, lock: true, text: '加载中，请稍等', spinner: 'loader', background: 'rgba(0, 0, 0, 0.7)' }

let loadingInstance

export default class Loader {
  constructor(vueThis) {
    this.vm = vueThis
  }
  open(option) {
    loadingInstance = Loading.service(Object.assign(loadOption, option || {}))
  }
  close() {
    loadingInstance && loadingInstance.close()
  }
}
